#ifndef CIOPS_OP_CREATERECTANGLE_H
#define CIOPS_OP_CREATERECTANGLE_H

#include <strstream>

#include "Operation.h"

namespace CIOps {
    /**
     * This class represents the operation of creation of a rectangle   
     **/
    class OP_CreateRectangle : public Operation {    

    public:            
        OP_CreateRectangle (std::vector<CIView::View*>& v);     //Constructor
        virtual ~OP_CreateRectangle();                          //Destructor

    protected:
        CIGeom::Geometry* rectangle;                //A pointer to the rectangle that will be added in the 3D scene
        CICore::Point topLeft;                      //The top left coordinate of the rectangle

        CICore::Orientation rotation;

        float height;                       //The rectangle height
        float width;                        //The rectangle width

        short rectangleDetail;              //The rectangle tessellation detail

        void AddFace (CICore::Vertex* v1, CICore::Vertex* v2, CICore::Vertex* v3, CICore::FaceLib& newFaces);
        
    public:            
        //Utility Methods
        virtual int Exec();         //Method called to execute directly the operation
        virtual void Undo();        //Method called to undo the operation
        virtual void Redo();        //Method called to redo the operation

        virtual void MousePressEvent (CIView::View* view, QMouseEvent* e);        //Mouse Pressed event handler
        virtual void MouseReleaseEvent (CIView::View* view, QMouseEvent* e);      //Mouse Released event handler
        virtual void MouseMoveEvent (CIView::View* view, QMouseEvent* e);         //Mouse Moved event handler
        virtual void WheelEvent (CIView::View* view, QWheelEvent* e);             //Wheel event handler
    };
}

#endif /* CIOPS_OP_CREATERECTANGLE_H */
